package com.netafull.util;

import java.io.BufferedInputStream;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;

import org.apache.http.util.ByteArrayBuffer;

import android.util.Log;

public class GT_Http {

	public static String sendToServer(String url) {
		String myString = null;
		if (url != null) {
			try {
				URL myURL = new URL(url);
				URLConnection ucon = myURL.openConnection();

				InputStream is = ucon.getInputStream();
				BufferedInputStream bis = new BufferedInputStream(is);

				ByteArrayBuffer baf = new ByteArrayBuffer(50);
				int current = 0;

				while ((current = bis.read()) != -1) {
					baf.append((byte) current);
				}
				myString = new String(baf.toByteArray());
			} catch (Exception e) {
				myString = e.getMessage();
				return null;
			}
		}
		//System.out.println("发送结果"+myString);
		return myString;
	}
}
